]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
shell: Add call to check the existence of a systemd unit
authorCarlos Garnacho <carlosg@gnome.org>
Thu, 10 Feb 2022 13:06:30 +0000 (14:06 +0100)
committerMarge Bot <marge-bot@gnome.org>
Fri, 11 Feb 2022 23:51:24 +0000 (23:51 +0000)
These checks will be handy while handling ibus-daemon startup, since
this is going to move to a systemd service soon.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2171>

src/shell-util.c
src/shell-util.h

index 4a53a7c99e97eb027a8d2cee53e86e9fbf51adca..a336868130cb73b102af34532d5ef4558cd40b06 100644 (file)
@@ -787,6 +787,25 @@ shell_util_stop_systemd_unit_finish (GAsyncResult  *res,
   return g_task_propagate_boolean (G_TASK (res), error);
 }
 
+void
+shell_util_systemd_unit_exists (const gchar         *unit,
+                                GCancellable        *cancellable,
+                                GAsyncReadyCallback  callback,
+                                gpointer             user_data)
+{
+  shell_util_systemd_call ("GetUnit",
+                           g_variant_new ("(s)", unit),
+                           SYSTEMD_CALL_FLAGS_NONE,
+                           cancellable, callback, user_data);
+}
+
+gboolean
+shell_util_systemd_unit_exists_finish (GAsyncResult  *res,
+                                       GError       **error)
+{
+  return g_task_propagate_boolean (G_TASK (res), error);
+}
+
 void
 shell_util_sd_notify (void)
 {
index 04485b99c1cbeef1a9484dc229366c9b16f893c3..7e1f7d88c16f4b4d13b674e0bb7234d997b06d30 100644 (file)
@@ -72,6 +72,13 @@ void  shell_util_stop_systemd_unit           (const char           *unit,
 gboolean shell_util_stop_systemd_unit_finish (GAsyncResult         *res,
                                               GError              **error);
 
+void shell_util_systemd_unit_exists (const gchar         *unit,
+                                     GCancellable        *cancellable,
+                                     GAsyncReadyCallback  callback,
+                                     gpointer             user_data);
+gboolean shell_util_systemd_unit_exists_finish (GAsyncResult  *res,
+                                                GError       **error);
+
 void shell_util_sd_notify (void);
 
 gboolean shell_util_has_x11_display_extension (MetaDisplay *display,